package server;

import infrastructure.exceptions.PrivilidgesException;
import infrastructure.exceptions.operations.OperationException;

import java.util.Iterator;

import server.querry.Condition;
import dal.IPet;
import dal.Pet_type;

/**
 * This is a session interface, all interactions with the server should be performed via this interface
 * @author sashas
 *
 */
public interface IServerSession {

	/**
	 * @return iterator to all types of the pets available on the systen
	 * @throws PrivilidgesException - in case that the session does not have the permissions 
	 * to perform this operation
	 */
	public Iterator<Pet_type> getAllPetTypes() throws PrivilidgesException;
	
	/**
	 * 
	 * @return iterator of all pers in the system
	 * @throws PrivilidgesException in case that the session does not have the permissions 
	 * to perform this operation
	 */
	public Iterator<IPet> getAllPets() throws PrivilidgesException;
	
	/**
	 * 
	 * @param querry - querry, so that only the pets that suites the condition 
	 * will be returned
	 * @return iterator to the pets that suites the conidtion 
	 * @throws PrivilidgesException in case that the session does not have the permissions 
	 * to perform this operation
	 */
	public Iterator<IPet> getPets(Condition querry) throws PrivilidgesException;
	 
	/**
	 * @param petToDeliver - pet to be delivered for the adotion 
	 * @throws OperationException in case that this pet already registered at the system
	 * @throws PrivilidgesException in case that the user does not have the previlidges to perform the operation
	 */
	public void giveForAdoption(IPet petToDeliver) throws OperationException,PrivilidgesException;
	
	
	/**
	 * This method removes the pet from the system 
	 * @param petToRemove - pet id to be removed from the system 
	 * @throws OperationException - in case that the pet was delived by the user other then this user
	 * @throws PrivilidgesException in case that the user does not have the previlidges to perform the operation
	 */
	public void removePetFromSystem(Integer  idOfThePetToRemove) throws OperationException,PrivilidgesException;
	
	/**
	 * @return session id of the session
	 */
	public long getSessionId();
	
		
	
}
